package com.wdl.modules.myhouse.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.wdl.modules.myhouse.entity.CommentsEntity;
import com.wdl.modules.myhouse.vo.CommentsVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * 评论表
 *
 * @author lucain sunlightcs@gmail.com
 * @since 1.0.0 2022-10-06
 */
@Mapper
public interface CommentsDao extends BaseMapper<CommentsEntity> {


    /**
     * 根据文件id获取根评论以及用户信息
     * @param fileId
     * @return
     */
    List<CommentsVo> allRootCommentByFileId(@Param("fileId")Long fileId);

    /**
     * 获取与文件相关的所有评论
     */
    List<CommentsVo> findAllByFileId(@Param("fileId")Long fileId);
    /**
     * 获取最新的几条根评论
     */
    List<CommentsVo> findCommentByCommentTimeDesc(@Param("num")Integer num);

}